home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11133 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  49 lines

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c,comp.lang.c++
  4. Subject: Re: SUN C Single key entry with no CR reqd
  5. Date: 12 Mar 1996 12:28:35 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4i4mpjINNqas@keats.ugrad.cs.ubc.ca>
  8. References: <4i1hr6$asm@ni1.ni.net> <4i434a$8nu@dawn.mmm.com>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <4i434a$8nu@dawn.mmm.com>, Kevin J Hopps <kjhopps@mmm.com> wrote:
  12.  >Ed Thomson (ethomson@cinahl.com) wrote:
  13.  >> I am new to SUN C and was wondering how to issue a statement like
  14.  >> getchar or getc but not require the user to press return after hitting
  15.  >> the key.
  16.  >
  17.  >It's somewhat complicated, actually.  The problem is that normally
  18.  >keyboard input is line buffered.  The terminal driver handles the
  19.  >characters and the backspaces and makes the entire line available
  20.  >to the application when a newline is entered.
  21.  >
  22.  >If you want to learn more about input processing from a keyboard,
  23.  >run "man termio" -- that's a start.
  24.  
  25. You don't have to go into that.
  26.  
  27. #include <curses.h>
  28.  
  29. int main()
  30. {
  31.     int c;
  32.  
  33.     initscr();
  34.     cbreak();
  35.     nonl();
  36.     noecho();
  37.  
  38.     c = getch();
  39.  
  40.     endwin();
  41.  
  42.     return 0;
  43. }
  44.  
  45. But that is severely off topic for this newsgroup. The proper place is
  46. comp.unix.programmer.
  47. -- 
  48.  
  49.